package com.ossjk.oa.advisory.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.SqlHelper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ossjk.oa.advisory.entity.Customer;
import com.ossjk.oa.advisory.entity.Customerfw;
import com.ossjk.oa.advisory.mapper.CustomerfwMapper;
import com.ossjk.oa.advisory.service.ICustomerService;
import com.ossjk.oa.advisory.service.ICustomerfwService;

/**
 * <p>
 * 客户跟进记录 服务实现类
 * </p>
 *
 * @author chair
 * @since 2019-02-15
 */
@Service
public class CustomerfwServiceImpl extends ServiceImpl<CustomerfwMapper, Customerfw> implements ICustomerfwService {
	@Autowired
	private ICustomerService iCustomerService;

	@Override
	public Page selectVoPage(Page page, Wrapper wrapper) {
		// TODO Auto-generated method stub
		SqlHelper.fillWrapper(page, wrapper);
		page.setRecords(baseMapper.selectVoPage(page, wrapper));
		return page;
	}

	@Override
	public boolean insert(Customerfw customerfw, Date date) {
		if (baseMapper.insert(customerfw) > 0) {
			Customer entity = new Customer();
			entity.setId(customerfw.getCid());
			entity.setNftm(date);
			iCustomerService.updateById(entity);
		}
		return true;
	}

}
